<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	var arr = [18,11,26,22,2,7,3,1];
	
	
	function mysort(a,b){
		return a-b; //升序   b-a降序
	}
	alert(arr.sort(mysort));  //方法作为参数传递时不需要写()  只有调用该方法时才加()  规定!
		
</script>
</head>
<body>

</body>
</html>